package com.deer.wms.base.system.service.MESWebService;

import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.deer.wms.base.system.dao.BillDetailMapper;
import com.deer.wms.base.system.dao.BillInfoMapper;
import com.deer.wms.base.system.dao.ItemInfoMapper;
import com.deer.wms.base.system.model.BillContDetailBO;
import com.deer.wms.base.system.model.BillContainerBO;
import com.deer.wms.base.system.model.BillDetail;
import com.deer.wms.base.system.model.BillInfo;
import com.deer.wms.base.system.model.Item.ItemInfo;
import com.deer.wms.base.system.model.Item.ItemInfoBO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import org.springframework.web.context.support.SpringBeanAutowiringSupport;

import javax.annotation.Resource;
import javax.jws.WebParam;
import javax.jws.WebService;
import java.util.ArrayList;
import java.util.List;

@WebService
@Service
@Lazy
public class MesWebServiceImpl implements MesWebService {

    @Autowired
    private IBillOutDetailService billOutDetailService;
    @Override
    public WebserviceResponse macIntf(@WebParam(name = "methodInvoke") String methodInvoke,
                                      @WebParam(name = "input") String input){
        WebserviceResponse webServiceResponse = null;
//        判断走哪个接口
        try{

            if(methodInvoke.equals("InStockReq")){
                //MES询问WMS包装入立体库
                webServiceResponse = billOutDetailService.InStockReq(input);
            }else if(methodInvoke.equals("EmptyShelfReq")){
                //MES询问立体库是否有空框
                webServiceResponse = billOutDetailService.EmptyShelfReq(input);
            }
        }catch(Exception e){
            e.printStackTrace();
        }
        return webServiceResponse;
    }

    @Override
    public WebserviceResponse billCallbackInfo(String methodInvoke, String input) {

        WebserviceResponse webServiceResponse = null;

        IBillOutDetailService billService = ApplicationContextUtil.getBean(IBillOutDetailService.class);
        //添加注释

        webServiceResponse = billService.EmptyShelfReq2(input);
        return null;
    }
}
